package com.yilifang.controller;

import com.yilifang.config.result.Result;
import com.yilifang.config.result.ResultGenerator;
import com.yilifang.service.OaNewsApiService;
import com.yilifang.service.ZbdlApiService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * Created by zhuan on 2018-09-18.
 */
@Slf4j
@RestController
@RequestMapping("/daAnnounce")
public class AnnounceController {

    @Autowired
    ZbdlApiService zbdlApiService;
    @Autowired
    OaNewsApiService oaNewsApiService;


    /**
     * 招标代理公告和内容
     * @param page
     * @param size
     * @return
     */
    @GetMapping("/zbdlAnnounce")
    public Result zbdlAnnounce(@RequestParam(value = "page",defaultValue = "1") Integer page,
                               @RequestParam(value = "size",defaultValue = "5") Integer size){

        return ResultGenerator.genSuccessResult(zbdlApiService.getZbdlAnnounce(page,size));
    }
    /**
     * OA新闻公告和内容
     * @param page
     * @param size
     * @return
     */
    @GetMapping("/oaNews")
    public Result oaNews(@RequestParam(value = "page",defaultValue = "1") Integer page,
                               @RequestParam(value = "size",defaultValue = "5") Integer size){

        return ResultGenerator.genSuccessResult(oaNewsApiService.getOANews(page,size));
    }
}
